
import java.sql.*;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author
 * hemmies
 */
public class Protocol {
    private String connectionUrl;
    private Connection con;
    private Statement statement;
    private ResultSet rs;
    
    public Protocol(){        
    }
    
    public void connect() throws ClassNotFoundException, SQLException{
        // Create a variable for the connection string.
        connectionUrl = "jdbc:sqlserver://localhost:49554;" +
         "databaseName=blaat;user=test;password=test";
        // Establish the connection.
         Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
         con =  DriverManager.getConnection(connectionUrl);
         
         statement = con.createStatement();
         
         rs = statement.executeQuery("SELECT * FROM Company");

    }
    
    public void show() throws SQLException{
        while( rs.next() ) {        
        String naam = rs.getString("Name");  // kolom ‘Naam’ 
        System.out.println(naam+" ");
    }

    }
    
}
